package com.ss.android.browser.base.wrapper.a;

import android.content.SharedPreferences;

import com.bytedance.common.utility.c.SharedPreferenceCompat;
import com.ss.android.article.base.app.BizApplication;

public final class BrowserSharedPreferencesWrapper {
    private static final SharedPreferences sSharedPreferences;
    private static final SharedPreferences.Editor sEditor;

    static {
        sSharedPreferences = BizApplication.getApplication().getContext().getSharedPreferences("sp_broswer", 0);
        sEditor = sSharedPreferences.edit();
    }

    public static void putString(String name, String value) {
        sEditor.putString(name, value);
        SharedPreferenceCompat.commit(sEditor);
    }

    public static void putTrueValue(String name) {
        sEditor.putBoolean(name, true);
        SharedPreferenceCompat.commit(sEditor);
    }

    public static void putLong(String name, long value) {
        sEditor.putLong(name, value);
        SharedPreferenceCompat.commit(sEditor);
    }

    public static boolean getBoolean(String name) {
        return sSharedPreferences.getBoolean(name, false);
    }

    public static String getString(String name, String defVal) {
        return sSharedPreferences.getString(name, defVal);
    }

    public static long getLong(String name) {
        return sSharedPreferences.getLong(name, 0);
    }
}

